package com.robot.base.common.api;

import com.qihang.annotations.ApiFactory;
import com.robot.base.model.BannerBean;
import com.robot.base.model.LoginBean;
import com.robot.base.model.ModuleBean;
import com.robot.base.model.PageListBean;
import com.robot.base.model.PreferentPageBean;
import com.robot.base.model.QuestionBean;
import com.robot.base.model.RibbonBean;
import com.robot.base.model.UserInfoBean;
import com.robot.base.model.VipBean;

import java.util.List;
import java.util.Map;

import io.reactivex.Observable;
import me.goldze.mvvmhabit.http.BaseResponse;
import okhttp3.MultipartBody;
import okhttp3.ResponseBody;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.Query;
import retrofit2.http.QueryMap;
import retrofit2.http.Streaming;
import retrofit2.http.Url;

@ApiFactory(value = GlBaseApi.class)
public interface UserService {

    //发送短信验证码
    @POST(" /app-api/app/account/auth/send-sms-code")
    Observable<BaseResponse<String>> sendSmsVerifyCode(@Body Map<String, Object> map);

    @Streaming
    @GET
    Observable<ResponseBody> dowloadApk(@Url String url);

    @POST("/app-api/app/account/auth/sms-login")
    Observable<BaseResponse<LoginBean>> smsLogin(@Body Map<String, Object> map);

    @POST("/app-api/app/account/auth/login")
    Observable<BaseResponse<LoginBean>> passwordLogin(@Body Map<String, Object> map);

    @GET("/app-api/app/account/users/userInfo")
    Observable<BaseResponse<UserInfoBean>> userInfo();

    @GET("/app-api/app/account/users/getOtherUser")
    Observable<BaseResponse<UserInfoBean>> otherUserInfo(@Query("id") String id);

    @POST("/app-api/app/account/auth/social-wechat-login")
    Observable<BaseResponse<LoginBean>> weChatLogin(@Body Map<String, Object> map);

    @POST("/app-api/app/account/auth/social-wechat-bind-openId-sms-login")
    Observable<BaseResponse<LoginBean>> weChatBindPhoneLogin(@Body Map<String, Object> map);

    @POST("/app-api/app/account/auth/social-wechat-bind-openId-up-login")
    Observable<BaseResponse<LoginBean>> weChatBindAccountLogin(@Body Map<String, Object> map);

    //手机统一登录，根据token获取手机号
    @POST("/app-api/app/account/auth/social-auth-token-phone")
    Observable<BaseResponse<LoginBean>> tokenPhone(@Body Map<String, Object> map);

    //APP根据Type类型功能区数据查询
    @GET("/app-api/app/infra/ribbon/getRibbonList")
    Observable<BaseResponse<List<RibbonBean>>> getRibbonList(@Query("type") int type);

    //根据coverType类型轮播图数据查询
    @GET("app-api/app/infra/cover-images/list")
    Observable<BaseResponse<List<BannerBean>>> getBannerList(@Query("coverType") int type);

    //获取VIP配置
    @GET("app-api/app/infra/vip/list")
    Observable<BaseResponse<List<VipBean>>> getVipList();

    //常见问题
    @GET("app-api/app/infra/ribbon/qapage")
    Observable<BaseResponse<PageListBean<QuestionBean>>> qapage(@QueryMap Map<String, Object> map);

    //查询模块图片接口
    @GET("/app-api/app/infra/ribbon/getModule")
    Observable<BaseResponse<List<ModuleBean>>> getModule(@Query("type") String type);


    /**
     * 上传图片
     *
     * @param part path 文件名
     * @return
     */
    @Multipart
    @POST("/app-api/app/infra/file/upload")
    Observable<BaseResponse<String>> upload(@Part MultipartBody.Part part);

    @GET("/app-api/app/infra/prefer/getPreferentPage")
    Observable<BaseResponse<PageListBean<PreferentPageBean>>> getPreferentPage(@QueryMap Map<String, Object> map);

    //关注
    @POST("/app-api/app/account/attention/followUsers")
    Observable<BaseResponse<String>> followUsers(@Body Map<String, Object> map);

    //忘记密码
    @POST("/app-api/app/account/auth/update-password")
    Observable<BaseResponse<String>> updatePassword(@Body Map<String, Object> map);

    //重置密码
    @POST("/app-api/app/account/auth/reset-password")
    Observable<BaseResponse<String>> resetPassword(@Body Map<String, Object> map);
}
